﻿namespace WebUI.Controls
{
    //using MgExtensions.HtzCore;
    using System;
    using System.Collections.Generic;
    using System.Runtime.CompilerServices;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using IGIS.Core;

    public class FeatureLogControl : UserControl
    {
        protected Repeater LogRepeater;

        protected void OnLogItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;
            if ((item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem))
            {
                Repeater logItem = item.FindControl("LogItem") as Repeater;
                logItem.DataSource = item.DataItem as Dictionary<string, string>;
                logItem.DataBind();
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.LogSource != null)
            {
                this.LogRepeater.DataSource = this.LogSource.Entries;
                this.LogRepeater.DataBind();
            }
        }

        public FeatureLog LogSource { get; set; }

        public string Title { get; set; }
    }
}

